package dyyx.demo;
import java.util.Date;

import org.h2.mvstore.MVStore;

import dyyx.util.CommUtil;

public class MVStoreCompactTest {

	public static void main(String[] args) throws Exception {
		System.out.println("hello,MVStoreCompactTest,"+new Date());
		
		String fileName = CommUtil.getUserHome()+"/h2/001.data";
		//  java.lang.IllegalArgumentException: Directory does not exist: nio:/Users/dugang/h2 [1.4.200/0]
		MVStore s = MVStore.open(fileName);
		
		long start = System.currentTimeMillis();
		s.compactFile(10000000);
		long end = System.currentTimeMillis();
		long time = end - start;
		
		System.out.println("time="+time);
		
		
		start = System.currentTimeMillis();
		s.compactMoveChunks();
		end = System.currentTimeMillis();
		time = end - start;		
		System.out.println("time1="+time);
		

		start = System.currentTimeMillis();
		s.close();
		end = System.currentTimeMillis();
		time = end - start;
		System.out.println("time2="+time);



	}
}
